﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BrettM.Web.Http
{
    public class ETagList : List<ETag>
    {
        public ETagList()
        {

        }

        public ETagList(IEnumerable<ETag> collection)
            : base(collection)
        {

        }

        public override string ToString()
        {
            var sb = new StringBuilder();
            var count = 0;
            foreach (var tag in
                this.Where(eTag => (object)eTag != null).Select(eTag => eTag.ToString()).Where(tag => tag != null))
            {
                if (count++ > 0) sb.Append(", ");
                sb.Append(tag);
            }
            return sb.ToString();
        }
    }
}
